/*****************************************************************************//*!
* file  : tx_dbg_info.c
* creat : apleilx
* data  : 2017/03/02
*******************************************************************************/
#include "tx_api.h"
#include "common.h"

const char * tx_err_txt[] =
{
    "TX_SUCCESS",
    "TX_DELETED",
    "TX_POOL_ERROR",
    "TX_PTR_ERROR",
    "TX_WAIT_ERROR",
    "TX_SIZE_ERROR",
    "TX_GROUP_ERROR",
    "TX_NO_EVENTS",
    "TX_OPTION_ERROR",
    "TX_QUEUE_ERROR",
    "TX_QUEUE_EMPTY",
    "TX_QUEUE_FULL",
    "TX_SEMAPHORE_ERROR",
    "TX_NO_INSTANCE",
    "TX_THREAD_ERROR",
    "TX_PRIORITY_ERROR",
    "TX_NO_MEMORY or TX_START_ERROR",
    "TX_DELETE_ERROR",
    "TX_RESUME_ERROR",
    "TX_CALLER_ERROR",
    "TX_SUSPEND_ERROR",
    "TX_TIMER_ERROR",
    "TX_TICK_ERROR",
    "TX_ACTIVATE_ERROR",
    "TX_THRESH_ERROR",
    "TX_SUSPEND_LIFTED",
    "TX_WAIT_ABORTED",
    "TX_WAIT_ABORT_ERROR",
    "TX_MUTEX_ERROR",
    "TX_NOT_AVAILABLE",
    "TX_NOT_OWNED",
    "TX_INHERIT_ERROR",
    "TX_NOT_DONE",
    "TX_CEILING_EXCEEDED",
    "TX_INVALID_CEILING",
    "TX_ERR_UNDEF",
    "TX_ERR_UNDEF",
    "TX_ERR_UNDEF",
};

/*******************************************************************************
* @brief  os_err_print
* \param[in] os_err : err code
* \param[in] file : file
* \param[in] line : line
* \retval: none
*******************************************************************************/
void os_err_print(uint16_t os_err, char *file, int line)
{
    if(os_err != TX_SUCCESS) 
    { 
        if(os_err <= TX_INVALID_CEILING) 
            api_dbg_print("tx api exe fault : %s @ file %s line-%d \n",tx_err_txt[os_err], file, line); 
        else 
            api_dbg_print("tx api exe fault : TX_FEATURE_NOT_ENABLED\n");
    }
}

